import { $r } from './utils';
import * as vscode from 'vscode';
import { cangjie } from './cangjie';
import { language } from './language';
import { globalData } from './globalData';
import { registerProvider } from './intellisenses/providers';
import { globalContext } from './intellisenses/globalContext';

export function activate(context: vscode.ExtensionContext) {
    globalData.init(context);
    globalContext.instance.initialize();
    language.newInstance(context.extensionPath);
    context.subscriptions.push(vscode.commands.registerCommand("cj.createProject",
        () => cangjie.createProject()));
    context.subscriptions.push(vscode.commands.registerCommand("cj.initProject",
        (fileUri: vscode.Uri) => cangjie.initProject(fileUri)));
    context.subscriptions.push(vscode.commands.registerCommand("cj.dependenciesTools",
        (fileUri: vscode.Uri) => cangjie.dependenciesTools(context.extensionPath, fileUri)));
    context.subscriptions.push(vscode.commands.registerCommand("cj.updateDependencies",
        (fileUri: vscode.Uri) => cangjie.updateDependencies(fileUri)));
    context.subscriptions.push(vscode.commands.registerCommand("cj.buildProject",
        () => cangjie.buildProject()));
    context.subscriptions.push(vscode.commands.registerCommand("cj.createFile",
        (fileUri: vscode.Uri) => cangjie.createFile(fileUri)));
    context.subscriptions.push(vscode.commands.registerCommand("cj.buildFile",
        (fileUri: vscode.Uri) => cangjie.buildFile(fileUri)));
    context.subscriptions.push(vscode.commands.registerCommand("cj.cleanProject",
        (fileUri: vscode.Uri) => cangjie.cleanProject(fileUri)));
    context.subscriptions.push(vscode.commands.registerCommand("cj.about",
        () => cangjie.showAbout(context.extensionPath)));
    registerProvider(context);
    vscode.window.showInformationMessage($r('activeNotice'));
}

export function deactivate() { }
